<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAdminLoginlogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_loginlog', function (Blueprint $table) {
            // 表引擎
            $table->engine = 'MyISAM';
            $table->charset = 'utf8';
            $table->collation = 'utf8_unicode_ci';
            $table->increments('id')->comment('编号id');
            $table->string('admin_name', 20)->comment('管理员账号');
            $table->string('true_name', 20)->nullable()->comment('姓名');
            $table->tinyInteger('status')->default(0)->comment('登录成功:1、成功，0、失败');
            $table->string('remark', 100)->default('')->comment('登录失败原因');
            $table->integer('action_time')->default(0)->comment('操作时间');
            $table->string('action_ip', 40)->default(0)->comment('操作ip');
        });
        $db_prefix = env('DB_PREFIX');
        DB::statement("ALTER TABLE {$db_prefix}admin_loginlog comment '后台登录日志表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_loginlog');
    }
}
